<div class="clientes view">
	<div class="row">
		<div class="col-md-12">
			<div class="page-header">
				<h1><?php echo __('Cliente'); ?></h1>
			</div>
		</div>
	</div>

	<div class="row">

		<div class="col-md-3">
			<div class="actions">
				<div class="panel panel-default">
					<div class="panel-heading">Ações</div>
						<div class="panel-body">
							<ul class="nav nav-pills nav-stacked">
									<li><?php echo $this->Html->link(__('<span class="glyphicon glyphicon-edit"></span>&nbsp&nbsp;Editar Cliente'), array('action' => 'edit', $cliente['Cliente']['id']), array('escape' => false)); ?> </li>
									<li><?php echo $this->Form->postLink(__('<span class="glyphicon glyphicon-remove"></span>&nbsp;&nbsp;Deletar Cliente'), array('action' => 'delete', $cliente['Cliente']['id']), array('escape' => false), __('Are you sure you want to delete # %s?', $cliente['Cliente']['id'])); ?> </li>
									<li><?php echo $this->Html->link(__('<span class="glyphicon glyphicon-list"></span>&nbsp&nbsp;Listar Clientes'), array('action' => 'index'), array('escape' => false)); ?> </li>
									<li><?php echo $this->Html->link(__('<span class="glyphicon glyphicon-plus"></span>&nbsp&nbsp;Adicionar Cliente'), array('action' => 'add'), array('escape' => false)); ?> </li>
									<li><?php echo $this->Html->link(__('<span class="glyphicon glyphicon-list"></span>&nbsp&nbsp;Listar Pedidos'), array('controller' => 'pedidos', 'action' => 'index'), array('escape' => false)); ?> </li>
									<li><?php echo $this->Html->link(__('<span class="glyphicon glyphicon-plus"></span>&nbsp&nbsp;Novo Pedido'), array('controller' => 'pedidos', 'action' => 'add'), array('escape' => false)); ?> </li>
							</ul>
						</div><!-- end body -->
				</div><!-- end panel -->
			</div><!-- end actions -->
		</div><!-- end col md 3 -->

		<div class="col-md-9">			
			<table cellpadding="0" cellspacing="0" class="table table-striped">
				<tbody>
					<tr>
						<th><?php echo __('Id'); ?></th>
						<td>
							<?php echo h($cliente['Cliente']['id']); ?>	&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Nome'); ?></th>
						<td>
							<?php echo h($cliente['Cliente']['nome']); ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('CPF'); ?></th>
						<td>
							<?php echo h($cliente['Cliente']['cpf']); ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('RG'); ?></th>
						<td>
							<?php echo h($cliente['Cliente']['rg']); ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Data de Nascimento'); ?></th>
						<td>	
							<?php echo CakeTime::format($cliente['Cliente']['data_nasc'], '%d/%m/%Y'); ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Sexo'); ?></th>
						<td>
							<?php echo h($cliente['Cliente']['sexo']); ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Email'); ?></th>
						<td>
							<?php echo h($cliente['Cliente']['email']); ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Telefone'); ?></th>
						<td>
							<?php echo h($cliente['Cliente']['telefone']); ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Celular'); ?></th>
						<td>
							<?php echo h($cliente['Cliente']['celular']); ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Estado Civil'); ?></th>
						<td>
							<?php echo $cliente['EstadoCivil']['descricao']; ?>
							&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Status'); ?></th>
						<td>
							<?php if($cliente['Cliente']['status'] == 0) echo h('Inativo'); else echo 'Ativo'; ?>&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Data de Cadastro'); ?></th>
						<td>
							<?php echo CakeTime::format($cliente['Cliente']['created'], '%d/%m/%Y  às  %H:%M:%S'); ?>
							&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Última Alteração'); ?></th>
						<td>
							<?php echo CakeTime::format($cliente['Cliente']['modified'], '%d/%m/%Y  às  %H:%M:%S'); ?>
							&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Tipo de Cliente'); ?></th>
						<td>
							<?php echo $cliente['TipoCliente']['descricao']; ?>
							&nbsp;
						</td>
					</tr>
					<tr>
						<th><?php echo __('Endereco'); ?></th>
						<td>
							<?php echo $this->Html->link($cliente['Endereco']['rua'] . ', '. $cliente['Endereco']['numero'] .' - '. $cidade['Cidade']['nome'] , array('controller' => 'enderecos', 'action' => 'view', $cliente['Endereco']['id'])); ?>
							&nbsp;
						</td>
					</tr>
					
				</tbody>
			</table>

		</div><!-- end col md 9 -->

	</div>
</div>

<div class="related row">
	<div class="col-md-12">
	<h3><?php echo __('Pedidos Relacionados'); ?></h3>
	<?php if (!empty($cliente['Pedido'])): ?>
	<table cellpadding = "0" cellspacing = "0" class="table table-striped">
	<thead>
	<tr>
		<th><?php echo __('Código'); ?></th>
		<th><?php echo __('Data e Hora'); ?></th>
		<th><?php echo __('Mesa'); ?></th>
		<th><?php echo __('Entregue'); ?></th>
		<th><?php echo __('Pagamento'); ?></th>
		<th><?php echo __('Valor Total'); ?></th>
		<th><?php echo __('Status');?></th>
		<th><?php //echo __('Cliente'); ?></th>
		<th class="actions"></th>
	</tr>
	<thead>
	<tbody>
	<?php foreach ($cliente['Pedido'] as $pedido): ?>
		<tr>
			<td><?php echo $pedido['id']; ?></td>
			<td><?php echo CakeTime::format($pedido['data_hora'], '%d/%m/%Y  às  %H:%M:%S'); ?></td>
			<td><?php echo $pedido['mesa']; ?></td>
			<td><?php if($pedido['status_entrega'] == 0) echo h('Não'); else echo 'Sim'; ?></td>
			<td><?php if($pedido['status_pagamento'] == 0) echo h('Não pagou'); else echo 'Pagou'; ?></td>
			<td><?php echo $pedido['valor_total']; ?></td>
			<td><?php if($pedido['status'] == 0) echo h('Cancelado'); else echo 'Ativo'; ?></td>
			<td><?php //echo $pedido['cliente_id']; ?></td>
			<td class="actions">
				<?php //echo $this->Html->link(__('<span class="glyphicon glyphicon-search" title="Visualizar"></span>'), array('controller' => 'pedidos', 'action' => 'view', $pedido['id']), array('escape' => false)); ?>
				<?php echo $this->Html->link(__('<span class="glyphicon glyphicon-edit" title="Editar Pedido" style="margin-left:16px;"></span>'), array('controller' => 'pedidos', 'action' => 'edit', $pedido['id']), array('escape' => false)); ?>
				<?php //echo $this->Form->postLink(__('<span class="glyphicon glyphicon-remove" title="Cancelar Pedido?" style="margin-left:16px;"></span>'), array('controller' => 'pedidos', 'action' => 'delete', $pedido['id']), array('escape' => false), __('Are you sure you want to delete # %s?', $pedido['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</tbody>
	</table>
<?php endif; ?>

	<div class="actions">
		<?php echo $this->Html->link(__('<span class="glyphicon glyphicon-plus"></span>&nbsp;&nbsp;Fazer novo Pedido'), array('controller' => 'pedidos', 'action' => 'add'), array('escape' => false, 'class' => 'btn btn-default')); ?> 
	</div>
	</div><!-- end col md 12 -->
</div>
